<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActiveScaffold::Actions::Delete</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActiveScaffold::Actions::Delete</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/active_scaffold/lib/actions/delete_rb.html">
                vendor/plugins/active_scaffold/lib/actions/delete.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000291">delete</a>&nbsp;&nbsp;
      <a href="#M000294">delete_authorized?</a>&nbsp;&nbsp;
      <a href="#M000292">destroy</a>&nbsp;&nbsp;
      <a href="#M000293">do_destroy</a>&nbsp;&nbsp;
      <a href="#M000290">included</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000290" class="method-detail">
        <a name="M000290"></a>

        <div class="method-heading">
          <a href="#M000290" class="method-signature">
          <span class="method-name">included</span><span class="method-args">(base)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000290-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000290-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/delete.rb, line 3</span>
3:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
4:       <span class="ruby-identifier">base</span>.<span class="ruby-identifier">before_filter</span> <span class="ruby-identifier">:delete_authorized?</span>, <span class="ruby-identifier">:only</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-identifier">:delete</span>, <span class="ruby-identifier">:destroy</span>]
5:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000291" class="method-detail">
        <a name="M000291"></a>

        <div class="method-heading">
          <a href="#M000291" class="method-signature">
          <span class="method-name">delete</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
this method is for html mode. it provides &quot;the missing action&quot;
(<a
href="http://thelucid.com/articles/2006/07/26/simply-restful-the-missing-action">thelucid.com/articles/2006/07/26/simply-restful-the-missing-action</a>).
it also gives us <a href="Delete.html#M000291">delete</a> confirmation for
html mode. woo!
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000291-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000291-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/delete.rb, line 9</span>
 9:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>
10:       <span class="ruby-ivar">@record</span> = <span class="ruby-identifier">find_if_allowed</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>], <span class="ruby-identifier">:destroy</span>)
11:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'delete'</span>
12:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000292" class="method-detail">
        <a name="M000292"></a>

        <div class="method-heading">
          <a href="#M000292" class="method-signature">
          <span class="method-name">destroy</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000292-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000292-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/delete.rb, line 14</span>
14:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy</span>
15:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">redirect_to</span>(<span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:delete</span>)) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">get?</span>
16: 
17:       <span class="ruby-identifier">do_destroy</span>
18: 
19:       <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
20:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">html</span> <span class="ruby-keyword kw">do</span>
21:           <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:info</span>] = <span class="ruby-identifier">as_</span>(<span class="ruby-value str">'Deleted %s'</span>, <span class="ruby-ivar">@record</span>.<span class="ruby-identifier">to_label</span>)
22:           <span class="ruby-identifier">return_to_main</span>
23:         <span class="ruby-keyword kw">end</span>
24:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">js</span> { <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'destroy.rjs'</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>) }
25:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">xml</span> { <span class="ruby-identifier">render</span> <span class="ruby-identifier">:xml</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">successful?</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">response_object</span>.<span class="ruby-identifier">to_xml</span>, <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Mime</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_status</span> }
26:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">successful?</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">response_object</span>.<span class="ruby-identifier">to_json</span>, <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Mime</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_status</span> }
27:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">yaml</span> { <span class="ruby-identifier">render</span> <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">successful?</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">response_object</span>.<span class="ruby-identifier">to_yaml</span>, <span class="ruby-identifier">:content_type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Mime</span><span class="ruby-operator">::</span><span class="ruby-constant">YAML</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">response_status</span> }
28:       <span class="ruby-keyword kw">end</span>
29:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000294" class="method-detail">
        <a name="M000294"></a>

        <div class="method-heading">
          <a href="#M000294" class="method-signature">
          <span class="method-name">delete_authorized?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
The default security delegates to <a
href="../../ActiveRecordPermissions.html">ActiveRecordPermissions</a>. You
may override the method to customize.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000294-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000294-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/delete.rb, line 42</span>
42:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_authorized?</span>
43:       <span class="ruby-identifier">authorized_for?</span>(<span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:destroy</span>)
44:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000293" class="method-detail">
        <a name="M000293"></a>

        <div class="method-heading">
          <a href="#M000293" class="method-signature">
          <span class="method-name">do_destroy</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
A simple method to handle the actual destroying of a record May be
overridden to customize the behavior
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000293-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000293-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/delete.rb, line 35</span>
35:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_destroy</span>
36:       <span class="ruby-ivar">@record</span> = <span class="ruby-identifier">find_if_allowed</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>], <span class="ruby-identifier">:destroy</span>)
37:       <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">successful</span> = <span class="ruby-ivar">@record</span>.<span class="ruby-identifier">destroy</span>
38:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>